﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<z.m.LocalPassword>" %>

<% using (Html.BeginForm("Manage", "User")) { %>
<%: Html.AntiForgeryToken() %>
<% if (Microsoft.Web.WebPages.OAuth.OAuthWebSecurity.HasLocalAccount(
		WebMatrix.WebData.WebSecurity.GetUserId(User.Identity.Name))) { %>
<fieldset>
	<legend>Change Password</legend>
	<table>
		<tr>
			<td><%: Html.LabelFor(m => m.OldPassword) %></td>
			<td><%: Html.PasswordFor(m => m.OldPassword) %></td>
			<td><%: Html.ValidationMessageFor(m => m.OldPassword) %></td>
		</tr>
		<tr>
			<td><%: Html.LabelFor(m => m.Password) %></td>
			<td><%: Html.PasswordFor(m => m.Password) %></td>
			<td><%: Html.ValidationMessageFor(m => m.Password) %></td>
		</tr>
		<tr>
			<td><%: Html.LabelFor(m => m.ConfirmPassword) %></td>
			<td><%: Html.PasswordFor(m => m.ConfirmPassword) %></td>
			<td><%: Html.ValidationMessageFor(m => m.ConfirmPassword) %></td>
		</tr>
		<tr>
			<td colspan="2">
				<input type="submit" value="Set password" /></td>
		</tr>
	</table>
</fieldset>
<%} else {%>
<fieldset>
	<legend>Set Password</legend>
	<p>
		You do not have a local password for this site. Add a local
    password so you can log in without an external login.
	</p>
	<table>
		<tr>
			<td><%: Html.LabelFor(m => m.Password) %></td>
			<td>
				<%: Html.PasswordFor(m => m.Password) %></td>
		</tr>
		<tr>
			<td><%: Html.LabelFor(m => m.ConfirmPassword) %></td>
			<td>
				<%: Html.PasswordFor(m => m.ConfirmPassword) %></td>
		</tr>
		<tr>
			<td colspan="2">
				<input type="submit" value="Set password" /></td>
		</tr>
	</table>
</fieldset>
<%}
	} %>